<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function getData(url) {	
			return new Promise(function(resolve,reject){
                var xhr=new XMLHttpRequest();				
				xhr.onreadystatechange=function(){									
					if(xhr.readyState==4){						
						if(xhr.status>=200&&xhr.status<=300||xhr.status==304){
							return resolve(xhr.responseText);//成功
						}else{
							return reject(xhr.responseText);//失败
						}
					}
				}				
				xhr.open("GET",url)			
				xhr.send(); 
            })
        }

		let promise=getData("http://localhost:3008/api/student/getStudent");
		promise.then((value)=>{
			console.log(value);
		}).catch(err=>{
			console.log(err);
		})
        


		function postData(url,data) {	
			return new Promise(function(resolve,reject){
                var xhr=new XMLHttpRequest();				
				xhr.onreadystatechange=function(){									
					if(xhr.readyState==4){						
						if(xhr.status>=200&&xhr.status<=300||xhr.status==304){
							return resolve(xhr.responseText);//成功
						}else{
							return reject(xhr.responseText);//失败
						}
					}
				}				
				xhr.open("POST",url)	
				xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded")			
				xhr.send(data); 
            })
        }
				
        postData("http://localhost:3008/api/student/removeStudent","id=1714445619432");


    </script>



</body>
</html>